#!/bin/sh /etc/rc.common
# Copyright (C) 2021 Ailick <277498654@qq.com>
# For syncing status of firewall full-cone into turboacc.

START=60
STOP=10
SERVICE=turboacc_fss

USE_PROCD=1

service_triggers(){
    procd_add_reload_trigger firewall
}

start_service(){
    [ ! -e "/etc/init.d/turboacc" ] && stop
    uci set turboacc.config.fullcone_nat="$(fullcone_status_get)" && uci commit turboacc
}

reload_service(){
    start
}

fullcone_status_get(){
	uci -q get firewall.@defaults[0].fullcone || echo 0
}
